import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  routes: [

    // {
    //   path: '/about',
    //   name: 'about',
    //   // route level code-splitting
    //   // this generates a separate chunk (about.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
    // }
    // 登录
    {
      path: '/login',
      name: 'login',
      component: () => import('./views/Login.vue')
    },
    // 主页
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect: '/welcome',
      children: [
        // 欢迎界面
        {
          path: 'welcome',
          name: 'welcome',
          component: () => import('./views/Welcome.vue')
        },
        // 权限列表
        {
          path: 'rights',
          name: 'rights',
          component: () => import('./views/auth/Rights.vue')
        },
        // 角色列表
        {
          path: 'roles',
          name: 'roles',
          component: () => import('./views/auth/Roles.vue')
        },

        {
          path: 'users',
          name: 'users',
          component: () => import('./views/user/User.vue')
        },
        // 订单列表
        {
          path: 'orders',
          name: 'orders',
          component: () => import('./views/order/OrderList.vue')
        },
        {
          path: 'select',
          name: 'select',
          component: () => import('./views/order/Select.vue')
        },
        // 数据统计
        {
          path: 'reports',
          name: 'reports',
          component: () => import('./views/statis/Reports.vue')
        },
        // 商品列表
        {
          path: 'goods',
          name: 'goods',
          component: () => import('./views/goods/Goods.vue')
        },
        // 添加商品
        {
          path: 'toadd',
          name: 'toadd',
          component: () => import('./views/goods/Toadd.vue')
        },
        // 商品分类
        {
          path: 'categories',
          name: 'categories',
          component: () => import('./views/goods/Categories.vue')
        },
        // 商品分类编辑
        {
          path: 'toedit/:id',
          name: 'toedit',
          component: () => import('./views/goods/Toedit.vue')
        }
      ]
    }

  ]
})
